package cn.com.twoke.easyproject.modules.system.converter;


import cn.com.twoke.easyproject.common.converter.BaseConverter;
import cn.com.twoke.easyproject.modules.system.domain.SysUser;
import cn.com.twoke.easyproject.modules.system.request.SaveOrUpdateSysUserRequest;
import cn.com.twoke.easyproject.modules.system.response.SysUserResponse;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring")
public interface SysUserConverter extends BaseConverter {

    SysUserConverter INSTANCE = Mappers.getMapper(SysUserConverter.class);

    @Mapping(target = "id", expression = "java(decode(request.getId()))")
    SysUser saveOrUpdateRequest2Entity(SaveOrUpdateSysUserRequest request);


    @Mapping(target = "id", expression = "java(encode(sysUser.getId()))")
    SysUserResponse entity2Response(SysUser sysUser);

}
